using System.Collections;

namespace CodePlex.DnD4eCampaignManager.DnD4e
{
    public static class ListExtensions
    {
        public static bool Equivalent(this IList list, IList secondList)
        {
            if ( list == null && secondList == null )
            {
                return true;
            }
            if ( ( list != null && secondList == null ) || ( list == null ) )
            {
                return false;
            }
            if ( list.Count != secondList.Count )
            {
                return false;
            }
            foreach ( object item in list )
            {
                if ( !secondList.Contains(item) )
                {
                    return false;
                }
            }
            return true;
        }
    }
}